sil-openclaw 0.4.5 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/CHANGELOG.md +186 -0
  2. package/README.md +33 -45
  3. package/dist/gateway/search-results.js +11 -7
  4. package/dist/index.js +24 -24
  5. package/dist/lib/allowlist-script.js +13 -0
  6. package/dist/lib/artifacts.js +30 -0
  7. package/dist/lib/credentials.js +2 -3
  8. package/dist/lib/host-wiring.js +44 -15
  9. package/dist/lib/pkce.js +3 -3
  10. package/dist/lib/search-results-log.js +23 -0
  11. package/dist/lib/search-results-store.js +13 -10
  12. package/dist/lib/shopping-call.js +143 -0
  13. package/dist/lib/sil-client.js +185 -1046
  14. package/dist/lib/tool-result.js +10 -3
  15. package/dist/tools/catalog.js +311 -1197
  16. package/dist/tools/doctor.js +25 -63
  17. package/dist/tools/identity.js +110 -245
  18. package/openclaw.plugin.json +16 -12
  19. package/package.json +7 -6
  20. package/schema/PROVENANCE.md +15 -0
  21. package/schema/shopping-brief-create-request.schema.json +98 -0
  22. package/schema/shopping-brief-create-response.schema.json +24 -0
  23. package/schema/shopping-brief-edit-request.schema.json +125 -0
  24. package/schema/shopping-brief-edit-response.schema.json +24 -0
  25. package/schema/shopping-brief-read-request.schema.json +15 -0
  26. package/schema/shopping-brief-read-response.schema.json +235 -0
  27. package/schema/shopping-domain-create-request.schema.json +160 -0
  28. package/schema/shopping-domain-create-response.schema.json +60 -0
  29. package/schema/shopping-domain-get-request.schema.json +18 -0
  30. package/schema/shopping-domain-get-response.schema.json +307 -0
  31. package/schema/shopping-domain-search-request.schema.json +18 -0
  32. package/schema/shopping-domain-search-response.schema.json +92 -0
  33. package/schema/shopping-offers-request.schema.json +31 -0
  34. package/schema/shopping-offers-response.schema.json +172 -0
  35. package/schema/shopping-product-get-request.schema.json +24 -0
  36. package/schema/shopping-product-get-response.schema.json +121 -0
  37. package/schema/shopping-profile-edit-request.schema.json +97 -0
  38. package/schema/shopping-profile-edit-response.schema.json +17 -0
  39. package/schema/shopping-search-request.schema.json +106 -0
  40. package/schema/shopping-search-response.schema.json +182 -0
  41. package/schema/shopping-seller-get-request.schema.json +24 -0
  42. package/schema/shopping-seller-get-response.schema.json +342 -0
  43. package/scripts/allowlist-openclaw.mjs +4 -5
  44. package/sil-shopping/SKILL.md +196 -97
  45. package/sil-shopping/references/mint.md +190 -0
  46. package/dist/lib/bind-channel.js +0 -10
  47. package/dist/lib/creation-entrypoint.js +0 -111
  48. package/dist/lib/derive-agent-id.js +0 -36
  49. package/dist/lib/profile-store.js +0 -568
  50. package/dist/tools/profile.js +0 -300
  51. package/scripts/create-shopper.mjs +0 -677
  52. package/sil-shopping/examples/multi_domain_shopper_walkthrough.md +0 -65
  53. package/sil-shopping/references/agent_creation_engine.md +0 -223
  54. package/sil-shopping/references/fill_and_feedback.md +0 -102
  55. package/sil-shopping/references/method_and_prds.md +0 -143
  56. package/sil-shopping/references/setup_onboarding.md +0 -64
  57. package/sil-shopping/references/shop_loop.md +0 -118
package/CHANGELOG.md CHANGED
@@ -10,6 +10,192 @@ release (`clawhub package publish --changelog`). See [README](./README.md#releas
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [0.5.0] - 2026-09-25
14
+
15
+ ### Added
16
+
17
+ - **The eleven `shopping_*` tools, on the agent contract.** 1:1 with the sil-api routes —
18
+ `shopping_domain_search` (read the registry in the buyer's words),
19
+ `shopping_domain_get` (a category's buying guide and the keys it is bought by),
20
+ `shopping_domain_create` (coin a new one), `shopping_search`, `shopping_product_get`
21
+ (the whole dossier on 1–10 variants), `shopping_offers` (dated prices and the brief's
22
+ seller terms, per offer, read live) and `shopping_seller_get` (one seller's
23
+ whole terms). Every tool the loop calls is named for what it does for the shopper;
24
+ only `sil_register`, `sil_whoami` and `sil_doctor` keep the `sil_` name.
25
+ - **The brief and the profile are tools now: `shopping_brief_create`,
26
+ `shopping_brief_edit`, `shopping_brief_read` and `shopping_profile_edit`.** One brief
27
+ per session, held in sil under the buyer's account and named by `brief` on every
28
+ search and offers call: a title, a narrative in their own terms, the product specs by
29
+ category and the seller specs under `seller`, and the `decision` sentence behind each
30
+ change. A spec is `key · op · value · currency? · reason?` — there is no hard or soft
31
+ on it, and a want no spec can carry stays in the narrative. `shopping_brief_read` with
32
+ no `id` lists the buyer's briefs, newest first, which is what a new chat opens on.
33
+ `shopping_profile_edit` writes what is true of them whatever they buy — a measurement
34
+ with its unit, a size as printed, a lasting taste, the `currency` they price in — and an
35
+ entry replaces the one of the same `name`.
36
+ - **`sil_whoami` answers the buyer's `measurements`, `preferences` and `currency`**, beside
37
+ the name, country and addresses, so a foot length written last session is never asked
38
+ for again. A money row on the brief or a search that names no currency means theirs;
39
+ sil converts nothing, so a new currency changes which offers come first, never a price.
40
+ - **The twenty-two schema artifacts, in `schema/`.** Each shopping tool's `parameters` IS
41
+ its committed request artifact, copied verbatim from `sil-services`
42
+ (`schema/PROVENANCE.md` names the commit), and each `ok` result IS the API's 200 body,
43
+ handed over untouched. The plugin adds no shape of its own in either direction, so
44
+ there is nothing here for the contract to drift from.
45
+ - **`ship_to` is the LABEL of an address the buyer has on file**, as `sil_whoami` lists
46
+ them — never a country. It localizes a search to that address; absent, sil uses the
47
+ buyer's default address. `shopping_offers` and `shopping_seller_get` take no address:
48
+ their `ships` answers for the default one.
49
+ - **Seller terms live on the brief, are answered per OFFER, and are never coined by the
50
+ agent.** `shopping_offers` takes the brief's id and the picked variant ids and nothing
51
+ else: sil reads the brief's `seller` specs — keys of the domain read's own
52
+ `seller_specs`, sil's base plus whatever branch research has coined — its price ceiling,
53
+ and the buyer's default address and currency, looks on the web for shops it does not
54
+ hold, and answers `seller_fit` on each offer: `ships` always (serviceable,
55
+ not_serviceable or unknown for that address), plus each seller key on the brief with that
56
+ seller's value where sil holds one. Offers in the buyer's currency and market come
57
+ first. `shopping_seller_get` is the details read beside it, carrying every seller key sil
58
+ holds as `specs`.
59
+ - **A key the domain does not hold is recorded, never refused.** The search takes any
60
+ well-formed key, answers the products it found and leaves that key absent from `fit`,
61
+ writing the ask on the search row so research can coin what buyers need. The skill keeps
62
+ it in the brief exactly as the buyer stated it and sends it with every other spec.
63
+ - **`shopping_domain_create` coins PRODUCT keys, marked `variant_spec` or
64
+ `product_spec`** — what identifies a purchasable variant, and what tells one product
65
+ from the next. The registry derives each key's operators from its `type`. A key an
66
+ ancestor already defines with the same type and unit is not coined again: the mint
67
+ answers `ok` and reports it `inherited: true`, so the agent may filter on it.
68
+ - **The skill drives one loop over the brief sil holds, and every tool it names now
69
+ answers.** Every chat opens on `sil_whoami` and a bare `shopping_brief_read`, so a
70
+ size, a width, a budget or a market already on file is never asked again. Then: settle the category, write every want as a
71
+ spec and every lasting fact to the profile **before** the next search, find the products
72
+ that fit the brief's product specs, price them and read the sellers against its seller
73
+ specs, and — when nothing fits — name the spec in the way, propose ONE relaxation, wait,
74
+ and write the buyer's word as a spec plus the one-sentence `decision` that says why.
75
+ One brief per conversation, never one per category.
76
+
77
+ ### Changed
78
+
79
+ - The sil-api request timeout is 45 s (was 15 s): a live cold search outlives 15 s, and the plugin
80
+ answered "sil is temporarily unavailable" while sil-api finished the leg and wrote the row.
81
+ - **BREAKING — `sil_register` answers `open`, and the session travels in the PATH.**
82
+ `<sil-web>/authorize/<session>?code_challenge=…`: every OpenClaw host masks the value of
83
+ a query parameter named `session`, so the buyer opened `session=***` and sil-web said
84
+ `invalid_session`. `auth_url` and `session_id` are off the wire (contract §5) — the
85
+ plugin still mints the session id and claims with it.
86
+ - **`sil_whoami` carries the buyer's `country` inside `identity`**, beside `name`, when the
87
+ read has one — absent when nothing on file says it, never inferred from an address.
88
+ - **BREAKING — `shopping_search` and `shopping_offers` name the brief.** `brief` is
89
+ required on both, and sil records the call against the want behind it. The search
90
+ carries the brief's product specs, written FROM the brief's — all of them, the same
91
+ ones. The offers carry the brief and the picked ids and nothing else: sil reads the
92
+ `seller` specs, `country` among them, off the brief, and they never ride on the search.
93
+ `ship_to` stays what it was on the search, the label of an address that localizes and
94
+ rules no seller out — never a market filter. To change what is asked, change the brief
95
+ with the buyer's decision; a spec is never left out of one call.
96
+ - **BREAKING — the catalog answer is the agent contract's, and the pre-contract one is
97
+ deleted.** `shopping_search` takes `brief` · `domain` · `query` · `n` · `specs` ·
98
+ `ship_to` and
99
+ answers with `products[]`, each carrying `fit` (only what sil verified — a key absent
100
+ from it is a gap to name, never a miss), the `variants` that fit, a price range per
101
+ currency, and `host` · `printed` where the page was read in this request and sil does
102
+ not hold the product yet. It asks nothing about
103
+ sellers: the dossier, the offers with their seller terms, and one seller's whole terms
104
+ are three separate reads now. Nothing is projected on the way back.
105
+ - **The honesty vocabulary the agent reads.** `printed` and `host` on a search result, like
106
+ `webpage_info` on the dossier, are the shop's own words — a claim, not a reading; their
107
+ absence means sil read the page itself. An empty `variants` says no
108
+ listed option fits. A price in another currency is a bound sil could not test. On an
109
+ offer's `seller_fit`, `ships: unknown` keeps that offer and a requested seller key
110
+ absent is a term sil has not read — never a term the seller lacks.
111
+ - **The `≤4` search-call bound is PER CATEGORY**, not per request. On a brief covering
112
+ boots and a helmet the old reading either halved the second category's budget or blew
113
+ the bound.
114
+ - **`sil.search_results` carries the `shopping_search` body** (`{status, products}`). The
115
+ method name, its two-layer authz and its one not-found body are untouched.
116
+ - **`openclaw.build.openclawVersion` / `pluginSdkVersion` record `2026.9.3`**, the host
117
+ this plugin is verified against. Diagnostics only; the `compat` floor stays
118
+ `>=2026.7.1` — nothing here needs a newer API.
119
+ - **A category inherits every ancestor key and may RE-DECLARE one for its own subtree.**
120
+ `shopping_domain_create`'s description and the category reference carry the signed rule:
121
+ a key is never renamed; declaring an ancestor's key with another unit, allowed-value set
122
+ or variant/product mark makes that definition win below the new path, converting
123
+ nothing; declaring it with nothing the ancestor does not already say is not a second
124
+ coin — the mint answers `ok` and reports it `inherited: true`. The previous wording
125
+ ("the same type and unit is not coined again") read as a ban on declaring it at all.
126
+
127
+ ### Removed
128
+
129
+ - **BREAKING — the local document store, its four verbs and `shopping_brief_compile`.**
130
+ The buyer's brief and measurements live in sil's backend under their account, so the
131
+ plugin keeps NOTHING of theirs on the agent's disk: `shopping_doc_find` / `read` /
132
+ `write` / `remove` and `shopping_brief_compile` do not register, there is no
133
+ deprecation stub and no read path for the old store. `$SIL_DATA_DIR` holds
134
+ `tokens.json` and `config.json` alone, and `sil_doctor` no longer reports
135
+ `store.unreadable:*`. A `shopper/` folder an earlier version left behind is read by
136
+ nothing and can be deleted.
137
+ - **BREAKING — the shopper-creation ceremony, whole.** Gone: the
138
+ `sil-openclaw-create-shopper` bin and its engine, the onboarding ladder and its
139
+ per-search pitch, `sil_register`'s `next_step: "offer_shopper"` breadcrumb (contract
140
+ §5), and `sil_doctor`'s `creationEntrypoint` field and `creation.entrypoint_present`
141
+ finding. A shopping intent runs the loop on whatever agent holds the plugin, with
142
+ nothing to set up first.
143
+ - **BREAKING — `sil_search`, `sil_product_get`, `sil_stores`, `sil_domain_find`,
144
+ `sil_domain_create` and the four `sil_doc_*` verbs.** Renamed, never aliased: the old
145
+ names do not register, and there is no deprecation stub.
146
+ - **The hand-mirrored wire types and their four structural gates.** The response shape
147
+ lives in the committed artifact; a second copy in the plugin was the first thing to
148
+ drift from it. What survives is one 200 gate — a plain object stating `status: "ok"`.
149
+ - **The top-level `status` / `advisories` refusal.** `status` is on the API body now, and
150
+ the wiring advisory rides its OWN result block rather than a key beside the contract's,
151
+ so a catalog route adding a field is no longer a breaking change on this side.
152
+ - **The registry's retired vocabulary** — `maturity`, `unset`, `predicates`, `applied`,
153
+ `option_set`, `charged_currency`, `handoff`, `data_type`, `level`, `axis`, `capped`,
154
+ `validated_at`, `value_set` — gone from the wire, the skill and the drift guards.
155
+ - **BREAKING — `sil_learn`, `sil_profile_materialize`, `sil_profile_search`,
156
+ `sil_profile_get` and `sil_profile_remove`**, along with the local domain model they
157
+ addressed: `method.md`, intent-keyed PRDs, the `{domain, product, intent}` triple,
158
+ `attach-asset` and its MIME allowlist. The buying guide and its keys belong to the
159
+ shared registry; what is local is the person and their jobs.
160
+ - **The pre-contract request surface, outright.** Gone: `filters` (`category`,
161
+ `price_min`/`price_max`, `condition`, `available`), `local_merchants`, the `cursor`
162
+ pagination, `checkout_url`, `specs_status`, the `{ns, key}` spec path, `sil_specs` (its
163
+ route was removed server-side and every call had been failing), and every client-side
164
+ pre-flight validator behind them. Each route refuses before it spends and names the
165
+ offender in its own message, so a second validator here could only drift.
166
+
167
+ ### Fixed
168
+
169
+ - **The wiring-drift detector reads a 2026.8.1+ host's config.** That host's migration
170
+ renamed `agents.list` (an array) to `agents.entries` (a map keyed by id), and the
171
+ detector went blind on it — reporting a healthy install as mis-wired, or the reverse.
172
+ It reads both shapes now.
173
+ - **A delivery miss says WHICH callId and WHY, where an operator reads it.** The host
174
+ writes a plugin's structured fields to the log file and renders the console line from
175
+ the message alone, so a container log showed `[plugins] sil_search_results_miss` and
176
+ nothing else — no callId to join a client's pull onto the search that produced it.
177
+ Every marker now repeats its fields inline (`sil_search_results_miss callId=<id>
178
+ reason=expired found=false`), and a search whose page was never buffered logs
179
+ `sil_search_results_skipped callId=<id> reason=refused:<status>|no_principal|
180
+ no_products` at the buffer — the two states that are `ok` to the agent and
181
+ unresolvable to a client. The WIRE is untouched: `sil.search_results` still answers
182
+ one `not_found` body for unknown, expired, foreign and logged-out alike.
183
+
184
+ ## [0.4.6] - 2026-07-24
185
+
186
+ ### Fixed
187
+
188
+ - **`sil.search_results` now exists on a stock gateway.** `activation` gains
189
+ `onStartup: true` (alongside the existing `onCapabilities: ["tool"]`, the
190
+ posture bundled extensions already ship). 0.4.5 registered the method into the
191
+ gateway's request-local *tool-discovery* registry, which the host deliberately
192
+ never installs as active — so dispatch, which resolves from the active
193
+ registry, answered `unknown method` for every paired client, and Studio
194
+ rendered the degraded notice instead of product cards. Loading at gateway
195
+ startup puts the registration in the registry dispatch actually reads, and the
196
+ agent tool path then prefers that same registry — one module instance, so the
197
+ page `sil_search` stores is the page the method hands back.
198
+
13
199
  ## [0.4.5] - 2026-07-23
14
200
 
15
201
  ### Added
package/README.md CHANGED
@@ -95,37 +95,11 @@ agent done — here's your checkout link, ready to pay:
95
95
 
96
96
  ## Turn your OpenClaw into your personal shopping expert
97
97
 
98
- So far your *general* agent did the shopping. Go one step further: create **one** persistent shopper that learns *you* once, then shops **any** niche like a specialist — it researches how to buy well in each niche the first time you shop it, and gets sharper every session.
98
+ So far your *general* agent did the shopping. Go one step further, with **nothing to set up**: install the plugin and the agent you already have shops **any** niche like a specialist, learning how to buy well in each one the first time you shop it and getting sharper every session.
99
99
 
100
- **Spec-Driven Shopping (SDS).** Say *"set up my shopper"* and the plugin runs a **light** interview (≤10 questions) to shape how it should behave (the persona) and capture your **cross-niche** facts and the rules it must never break — and that's the whole setup. **No niche is researched up front.** From then on you just shop. The first time you ask for something in a new niche it **classifies** what you're buying, **researches that niche deeply on the spot** (the full how-to-buy-well: fit, gearing, geometry, the trade-offs — announced, so you can correct it), and derives the **dimensions** every request in that niche is decomposed along — minting a reusable **domain**. Ask for that niche again and it reuses what it learned; ask for a new one and it learns that too, keeping *you* the same across all of them. On **every query** it refreshes the domain knowledge from the web, decomposes what you asked, and **learns your facts and taste as it goes** (your measurements, your budget, a brand you won't touch) — captured once, never re-asked. It recommends with a "why" that cites *what you asked*, *a fact it remembered*, and *a niche mechanic you'd never have named*. **Nothing is created until you say so**, and a second shopper is refused — there is exactly one of you. Creating and running it is local and offline, no sign-in required.
100
+ **Spec-Driven Shopping (SDS).** There is no setup step and no interview — just say what you want. The first time you ask for something in a new niche the plugin **classifies** what you're buying, **researches that niche deeply on the spot** (the full how-to-buy-well: fit, gearing, geometry, the trade-offs — announced, so you can correct it), and derives the **dimensions** every request in that niche is decomposed along, minting a reusable **domain**. Ask for that niche again and it reuses what it learned; ask for a new one and it learns that too, keeping *you* the same across all of them. On **every query** it reads sil's shared registry for how that category is bought, decomposes what you asked, and **learns your facts and taste as it goes** (your measurements, your budget, a brand you won't touch) — captured once, never re-asked. It recommends with a "why" that cites *what you asked*, *a fact it remembered*, and *a niche mechanic you'd never have named*.
101
101
 
102
- **1 — One light conversation creates your shopper (no niche research yet):**
103
-
104
- ```text
105
- you set up my shopper
106
-
107
- agent Love it — let's shape it lightly. Should it shop patient and
108
- thorough, or fast and decisive? Anything it must always do,
109
- or never do?
110
-
111
- you thorough, and never recommend anything I can't return
112
-
113
- agent Got it — I'll keep your cross-niche rules (free returns only)
114
- and learn each niche the first time you shop it. Nothing to
115
- research up front.
116
-
117
- Your Shopper — a thorough, returns-first buyer
118
- · learns any niche on first shop · keeps your facts across all of them
119
-
120
- shall I create it?
121
-
122
- you yes, create it
123
-
124
- agent done — your shopper is live. Just tell it what you want;
125
- it learns the niche on the fly.
126
- ```
127
-
128
- **2 — It learns a niche the first time you shop it, and keeps *you* across all of them:**
102
+ **It learns a niche the first time you shop it, and keeps *you* across all of them:**
129
103
 
130
104
  ```text
131
105
  you find me a road bike, ~€1500
@@ -153,37 +127,50 @@ agent Different niche — camping. Learning how to buy a backpacking
153
127
  returns rule carries straight over, no need to re-ask.
154
128
  ```
155
129
 
156
- > **You teach it once; it stays sharp.** It keeps your facts and taste, web-refreshes its niche knowledge each visit, and never re-asks what it already knows. See what your shopper knows and which domains it has learned, look at how a domain is set up, forget one you're done with — or **refine** the shopper or a domain from what it watched you reject, so it gets sharper every session.
130
+ > **You teach it once; it stays sharp.** How a category is bought comes from sil's shared registry — read before the web, so it is current without you teaching it twice — and your own facts, taste and shopping jobs belong to your sil account rather than to one agent. Nothing to re-answer, and sharper every session.
157
131
 
158
- **What it remembers, and where it lives.** Your shopper learns your shopping-relevant facts as it goes — measurements, budget band, the rules it must never break, brand likes/dislikes — captured **only when a request actually needs them** (never a big up-front form) so it doesn't re-ask. All of it is stored **locally on your machine** (`$SIL_DATA_DIR/shopper/`, owner-only `0600`), **per-user (one shopper, many domains)**. It is **never pooled across users and never sent to a server** for training or aggregation — creating and running your shopper is local and offline. The niche web-refresh reads public sources to keep the *domain* knowledge current; it does not upload anything about you. Inspect exactly what your shopper holds with `sil_profile_get`, and forget one domain it learned with `sil_profile_remove`.
132
+ **What it keeps on your machine: nothing of yours.** The plugin stores your sil credentials and its own configuration under `$SIL_DATA_DIR` (owner-only `0600`) and nothing else — no notes about you, no shopping jobs, no measurements. A shopping call reads that credential, rewrites it when sil refreshes it, and deletes it when the session is past refreshing. What your agent learns about you lives in your sil account, is **never pooled across users**, and is never used for training or aggregation. Research reads public sources to learn how a *category* is bought; it does not upload anything about you. If an earlier version left a `shopper/` folder under that directory, nothing reads it any more and you can delete it.
159
133
 
160
134
  ---
161
135
 
162
136
  ## Tools
163
137
 
164
- Namespaced `sil_*` so they never collide with other plugins. Your agent calls them for you — you just say what you want.
138
+ Fourteen tools. The eleven the shopping loop calls are named `shopping_*` — for what
139
+ they do for you — and the three account tools keep the `sil_` name. Your agent calls them
140
+ for you; you just say what you want.
165
141
 
166
- **Identity**
142
+ **Your account**
167
143
 
168
144
  | Tool | What it does |
169
145
  |---|---|
170
- | `sil_register` | Start a browser sign-in and link your agent to your sil identity. Returns an `auth_url` to open; once you've signed in, the agent is registered and can transact. Takes no arguments. |
171
- | `sil_whoami` | Read your sil identity — name and saved addresses — as the agent sees it. Takes no arguments. |
146
+ | `sil_register` | Start a browser sign-in and link your agent to your sil identity. Takes no arguments. |
147
+ | `sil_whoami` | Read your sil identity — name, country, the currency you price in, saved addresses, and the measurements and preferences sil holds for you — as the agent sees it. Takes no arguments. |
148
+ | `sil_doctor` | Check the install: file modes, credential health, host wiring, and whether a newer plugin is published. Reports; repairs only what is safe. |
172
149
 
173
- **Catalog**
150
+ **Your brief and your profile**
174
151
 
175
152
  | Tool | What it does |
176
153
  |---|---|
177
- | `sil_search` | Search for purchasable products. A free-text `query` plus optional filters: `category`, `price_min`/`price_max`, `ship_to` (delivery destination — leave empty to ship to your registered address), `condition` (`new` / `secondhand`), `available`, and `local_merchants` (best-effort bias toward shops in the user's own country). Results are **localized** to the shopper; when they ask for local shops you can *optionally* issue the `query` in that country's language to surface more of them (e.g. a French query surfaces French stores) — a tactic, not a requirement, and never an override of a language the user deliberately chose. Returns a ranked list of variants — each with `id`, `title`, `price`, `availability`, `checkout_url`, `source`, plus (where the source provides them) evaluate-before-buy detail: a product/variant `url` to view, a `description`, `media`, the product `options`, and the `seller`'s **shipping & return policy links** — and a pagination `cursor`. Location filters take ISO codes (`US`, `CA`), not place names. |
178
- | `sil_product_get` | Resolve `ids` you already hold to full products in UCP shape — `description`, `options`, `media`, the `seller`'s shipping & return policy links, and the featured purchasable variant with fresh `price`, `availability`, `url` (the page to view), and `checkout_url` (the link that buys). Re-fetch right before buying; those values are point-in-time, not guarantees. Ids that no longer resolve come back in `not_found`. |
154
+ | `shopping_brief_create` | Open the shopping job this conversation works from — a title and what you are after in your own words, plus any wants you have already stated. One brief per conversation, across every category it covers. |
155
+ | `shopping_brief_edit` | Write a want, a change of mind or the end of the job into that brief: the values you want under the category they belong to, the seller terms under `seller`, the keys you have given up, and one sentence saying what you changed and why. |
156
+ | `shopping_brief_read` | With no arguments, your shopping jobs, newest first — so a new chat carries on where the last one stopped. With an `id`, that whole brief: what you are after, every want under its category, and the decisions you have already taken. |
157
+ | `shopping_profile_edit` | Write what is true of you whatever you are buying: a measurement with its unit, a size as it is printed, a lasting taste in your own words, or the currency you price in. Writing the same name again replaces it; `sil_whoami` reads it all back. A new currency changes which offers come first, never a price: sil converts nothing. |
179
158
 
180
- **Your shopper** — create one shopper, then manage the domains it learns
159
+ **Shopping**
181
160
 
182
161
  | Tool | What it does |
183
162
  |---|---|
184
- | `sil_profile_materialize` | Write your shopper's behaviour artefacts under `$SIL_DATA_DIR/shopper/`. One tool, two modes: **create** your shopper (the shared, cross-niche `user_spec.md` + a `profile.json` manifest, no niche pack), or **mint/refresh a domain** the first time you shop a niche (that niche's `domain_spec.md` (deep researched niche expertise) + `intent_spec.md` (the decomposition-dimension schema) + `playbook.md` (your niche shopping taste), alongside the shared `user_spec.md`). (The persona is the agent's host workspace `SOUL.md`, not a sil artefact.) Validate-first and fail-closed; it never clobbers an existing domain, and a second shopper is refused. |
185
- | `sil_profile_get` | Show your shopper — with **no arguments**, the overview (`name`, the shared `userSpec`, the domain index of everything it has learned; an empty store is healthy); pass a `domainSlug` for one domain's `domainSpec` + `intentSpec` + `playbook`. |
186
- | `sil_profile_remove` | Forget ONE domain — pass its `domainSlug`; your shopper, your shared facts, and every other domain survive. Scoped and idempotent; the agent confirms with you before removing. |
163
+ | `shopping_domain_search` | Read sil's shared registry in your own words and get back the categories that match, each with a line on how the thing is bought. An empty list is the one answer that licenses a mint. |
164
+ | `shopping_domain_get` | Read one standing category: its buying guide, and every key it is bought by with the operators, unit and allowed values each takes. |
165
+ | `shopping_domain_create` | Coin a NEW category — its path, a guide written from research, and its first keys. The one permanent, global write in sil; an existing path is refused and nothing is written. |
166
+ | `shopping_search` | Search one settled category, under the brief this conversation is working from. Send the brief's id, the domain, your own shopping words, how many products you want, the brief's own values for that category as `specs`, and `ship_to` — the label of one of your saved addresses, which localizes the search (your default one when it is left off) and rules no seller out. Products come back best-first with `fit` (what sil verified), their variants, a price range, and `webpage_info` where sil has not read the page yet. |
167
+ | `shopping_product_get` | Open the whole of what sil holds on 1–10 shortlisted variants: the description, the images, every key sil holds, and where each reading came from and when. |
168
+ | `shopping_offers` | Price 1–10 picked variants live, on your own terms: send the brief's id and the variant ids, and sil reads the rest — the brief's `seller` terms and price ceiling, your default address and your currency. It looks on the web for shops it does not hold yet, and each offer comes back with the price exactly as the page prints it, its currency, availability, the listing URL, the moment sil read it, and `seller_fit` — whether that seller ships to your address (`serviceable`, `not_serviceable` or `unknown`) and what it holds for each term on the brief. Shops in your currency and market come first. |
169
+ | `shopping_seller_get` | One seller's whole terms, for 1–10 of them: `specs` (every seller key sil holds a value for), whether it ships to you, and the shipping routes and return terms sil has read. `unknown` keeps the seller; it just means sil has not read that policy. |
170
+
171
+ **The wire is a contract, not a convention.** Each shopping tool's input schema IS the
172
+ artifact under [`schema/`](./schema), copied verbatim from sil-services, and each answer
173
+ is the API's own 200 body handed over untouched.
187
174
 
188
175
  ---
189
176
 
@@ -191,10 +178,11 @@ Namespaced `sil_*` so they never collide with other plugins. Your agent calls th
191
178
 
192
179
  The plugin ships one bundled skill — **`sil-shopping`** 🛒 — that your agent loads automatically the first time you express a shopping intent. You don't invoke it; it's the playbook that makes the tools work well together:
193
180
 
194
- - **Routes intent to the right tool.** *"find me a keyboard"* → `sil_search`, *"look these up"* → `sil_product_get`, *"who am I?"* → `sil_whoami`, *"sign me up"* → `sil_register`, *"set up my shopper"* → the create flow, *"what does my shopper know / forget the grocery domain"* → the `sil_profile_*` tools.
195
- - **One shopper, many niches — minted on the fly.** Asked to set up shopping, it runs a short two-touchpoint onboarding (how your shopper should behave + your cross-niche facts and hard rules) and creates **one** shopper — creating nothing until you explicitly endorse the draft. From then on it shops *any* niche: it classifies what you're buying, reuses a niche it has already learned or **researches a new one on the spot** (announced, so you can correct it), and derives how to decompose every request — learning your facts and taste as it goes.
181
+ - **Routes intent to the right tool.** *"find me a keyboard"* → `shopping_search`, *"what does it cost?"* → `shopping_offers`, *"will it reach me?"* → `shopping_seller_get`, *"what was I shopping for?"* → `shopping_brief_read`, *"who am I?"* → `sil_whoami`, *"sign me up"* → `sil_register`.
182
+ - **Many niches, minted on the fly, with no preparation.** A shopping intent runs the loop on whatever agent holds the plugin: it classifies what you're buying, reuses a niche it has already learned or **researches a new one on the spot** (announced, so you can correct it), and derives how to decompose every request — learning your facts and taste as it goes.
196
183
  - **Recovers the right way.** Every tool reports a status; the skill follows that tool's own recovery hint — re-register, fix the query, or retry — instead of guessing a fix that won't work.
197
- - **Keeps prices honest.** It treats price, availability, and checkout links as point-in-time and re-checks an item right before you buy, so the link you get is the link you pay.
184
+ - **Keeps prices honest.** A price is dated only where sil dated it, so the skill re-reads an item's offers right before you buy and quotes the moment they were read.
185
+ - **Says what sil verified, and says the rest as what it is.** A key sil holds no value for is named as a gap, not passed off as a miss; a page sil has not read yet is quoted as the seller's own words; a seller sil knows nothing about keeps its place.
198
186
 
199
187
  Because the skill ships inside the plugin, installing the plugin installs the skill — there's nothing extra to set up.
200
188
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * `sil.search_results` — the plugin-owned gateway method a paired client calls
3
- * to pull a `sil_search` page by the `callId` it already saw on the tool
3
+ * to pull a `shopping_search` page by the `callId` it already saw on the tool
4
4
  * identity frames.
5
5
  *
6
6
  * NOT a tool, which is why it lives outside `src/tools/`: it never reaches the
@@ -28,6 +28,7 @@
28
28
  * log marker, and nothing on the wire has a field, shape, or timing tell.
29
29
  */
30
30
  import { hasTokens, readConfig } from "../lib/credentials.js";
31
+ import { logSearchResults } from "../lib/search-results-log.js";
31
32
  import { getSearchResult, searchResultMiss } from "../lib/search-results-store.js";
32
33
  export const SEARCH_RESULTS_METHOD = "sil.search_results";
33
34
  /** The ONE failure body: unknown ≡ expired ≡ wrong-principal ≡ no live session.
@@ -54,7 +55,7 @@ export function registerSearchResultsMethod(api) {
54
55
  resolve(api, params, respond);
55
56
  }
56
57
  catch (err) {
57
- api.logger.error("sil_search_results_failed", {
58
+ logSearchResults(api, "error", "failed", {
58
59
  cause: err instanceof Error ? err.message : String(err),
59
60
  });
60
61
  respond(true, NOT_FOUND);
@@ -64,7 +65,7 @@ export function registerSearchResultsMethod(api) {
64
65
  function resolve(api, params, respond) {
65
66
  const callId = params["callId"];
66
67
  if (typeof callId !== "string" || callId.length === 0) {
67
- api.logger.info("sil_search_results_invalid", { reason: "invalid_call_id" });
68
+ logSearchResults(api, "info", "invalid", { reason: "invalid_call_id" });
68
69
  respond(true, INVALID_REQUEST);
69
70
  return;
70
71
  }
@@ -74,20 +75,23 @@ function resolve(api, params, respond) {
74
75
  // identity that produced it, never to the machine.
75
76
  const principal = hasTokens() ? readConfig()?.user?.id : undefined;
76
77
  if (principal === undefined) {
77
- api.logger.info("sil_search_results_miss", { found: false, reason: "no_principal" });
78
+ logSearchResults(api, "info", "miss", { callId, reason: "no_principal", found: false });
78
79
  respond(true, NOT_FOUND);
79
80
  return;
80
81
  }
81
82
  const page = getSearchResult(callId, principal);
82
83
  if (page === null) {
83
- api.logger.info("sil_search_results_miss", {
84
+ // One `lookup` answers both, so a null page always has a cause; the fallback keeps
85
+ // the line honest rather than naming a cause the store did not give.
86
+ logSearchResults(api, "info", "miss", {
87
+ callId,
88
+ reason: searchResultMiss(callId, principal) ?? "unattributed",
84
89
  found: false,
85
- reason: searchResultMiss(callId, principal),
86
90
  });
87
91
  respond(true, NOT_FOUND);
88
92
  return;
89
93
  }
90
- api.logger.info("sil_search_results_hit", { found: true, count: page.products.length });
94
+ logSearchResults(api, "info", "hit", { callId, count: page.products.length, found: true });
91
95
  // Handed over BY REFERENCE, aliasing the array the agent envelope already
92
96
  // serialized. Deliberate: both paths JSON-serialize immediately and neither
93
97
  // mutates, so a defensive clone would copy ~50 KB per resolve for nothing.
package/dist/index.js CHANGED
@@ -1,21 +1,23 @@
1
1
  /**
2
2
  * sil OpenClaw plugin — entry point.
3
3
  *
4
- * A UCP commerce plugin for sil. It registers its real tool groups —
5
- * identity (`sil_register`, `sil_whoami`) and catalog (`sil_search`,
6
- * `sil_product_get`) — so they load in an OpenClaw host. There is no
7
- * transport, no persistent service, and no background work at register
8
- * time — `register()` is strictly synchronous and opens nothing.
4
+ * A UCP commerce plugin for sil. It registers its real tool groups — the account
5
+ * tools (`sil_register`, `sil_whoami`, `sil_doctor`) and the eleven `shopping_*`
6
+ * catalog tools — so they load in an OpenClaw host.
7
+ * There is no transport, no persistent service, and no background work at
8
+ * register time — `register()` is strictly synchronous and opens nothing.
9
9
  *
10
10
  * `register()` MUST stay synchronous and side-effect-free beyond
11
- * registering tools, ensuring the data dir, and logging. The reference
12
- * adapter (`klodi-plugin/adapters/openclaw`) carries a smoke gate
13
- * precisely because an eager connection opened in `register()` once held
14
- * the host's install subprocess event loop open and blocked gateway
15
- * startup. Keep it that way: all I/O lives inside a tool's `execute()` —
16
- * no timers, no sockets, no unawaited promises here. The one synchronous
17
- * `mkdirSync` (via `ensureDataDir()`) is exempt: it returns immediately
18
- * and holds no resource open.
11
+ * registering tools, ensuring the data dir, reading the shopping
12
+ * artifacts, and logging. The reference adapter
13
+ * (`klodi-plugin/adapters/openclaw`) carries a smoke gate precisely
14
+ * because an eager connection opened in `register()` once held the host's
15
+ * install subprocess event loop open and blocked gateway startup. Keep it
16
+ * that way: all NETWORK I/O lives inside a tool's `execute()` — no timers,
17
+ * no sockets, no unawaited promises here. Two synchronous filesystem reads
18
+ * are exempt because they return immediately and hold no resource open:
19
+ * `ensureDataDir()`'s `mkdirSync`, and the `readFileSync` each artifact-backed
20
+ * tool makes to publish its request artifact as its `parameters`.
19
21
  *
20
22
  * To add a tool, see `src/tools/identity.ts` (the reference group — it
21
23
  * sets the `jsonResult` success shape and structured-error envelope every
@@ -29,7 +31,6 @@ import { detectWiringDrift, readSilWiringFacts } from "./lib/host-wiring.js";
29
31
  import { registerCatalogTools } from "./tools/catalog.js";
30
32
  import { registerDoctorTools } from "./tools/doctor.js";
31
33
  import { registerIdentityTools } from "./tools/identity.js";
32
- import { registerProfileTools } from "./tools/profile.js";
33
34
  export default definePluginEntry({
34
35
  id: "sil",
35
36
  name: "sil",
@@ -38,10 +39,10 @@ export default definePluginEntry({
38
39
  register(api) {
39
40
  applyPluginConfigOverrides(api.pluginConfig);
40
41
  // Guarantee the data home exists from the instant register() returns — not
41
- // lazily on first write — so tokens, config, and SDS profile artefacts have
42
- // one consistent home from load. One-shot synchronous mkdir (recursive,
43
- // 0700): it returns immediately and holds no resource open, so the
44
- // register()-stays-synchronous / opens-nothing invariant is preserved.
42
+ // lazily on first write — so tokens and config have one consistent home from
43
+ // load. One-shot synchronous mkdir (recursive, 0700): it returns immediately
44
+ // and holds no resource open, so the register()-stays-synchronous /
45
+ // opens-nothing invariant is preserved.
45
46
  //
46
47
  // Fail-closed: an uncreatable home (parent unwritable, path occupied by a
47
48
  // file → ENOTDIR, no space) is logged LOUDLY and DISTINCTLY (the path + OS
@@ -56,10 +57,10 @@ export default definePluginEntry({
56
57
  catch (err) {
57
58
  const cause = err instanceof Error ? err.message : String(err);
58
59
  api.logger.error("sil_plugin_data_dir_failed", {
59
- message: "sil could NOT create its data directory at registration, so tokens,"
60
- + " config, and profiles have no home. Fix the data directory (it must"
61
- + " be writable — check permissions / free space / that $SIL_DATA_DIR"
62
- + " is a directory), then reload the plugin.",
60
+ message: "sil could NOT create its data directory at registration, so its tokens"
61
+ + " and config have no home. Fix the data directory (it must be writable"
62
+ + " — check permissions / free space / that $SIL_DATA_DIR is a"
63
+ + " directory), then reload the plugin.",
63
64
  data_dir: getDataDir(),
64
65
  cause,
65
66
  });
@@ -67,12 +68,11 @@ export default definePluginEntry({
67
68
  }
68
69
  registerIdentityTools(api);
69
70
  registerCatalogTools(api);
70
- registerProfileTools(api);
71
71
  registerDoctorTools(api);
72
72
  // The pull surface a paired client resolves a search page from. Registering
73
73
  // a closure opens nothing — no socket, no timer — so the invariant above
74
74
  // holds; the store behind it is touched only inside the handler and inside
75
- // sil_search's execute(). NOT a tool and NOT a `registerXTools` group: it
75
+ // shopping_search's execute(). NOT a tool and NOT a `registerXTools` group: it
76
76
  // never reaches the model, and the manifest's `contracts` vocabulary has no
77
77
  // gateway-method key, so this call IS the declaration.
78
78
  registerSearchResultsMethod(api);
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The absolute path of the shipped tool-admission script, for prose telling an operator to
3
+ * run it: a bare bin name reaches PATH only on an npm-global install, and node normalizes a
4
+ * `..` hop through the host's skill SYMLINK lexically. `import.meta.url` is the sound root.
5
+ */
6
+ import { dirname, join } from "node:path";
7
+ import { fileURLToPath } from "node:url";
8
+ export const ALLOWLIST_SCRIPT_RELATIVE = "scripts/allowlist-openclaw.mjs";
9
+ /** Two levels up reaches the plugin root from both `src/lib/` and `dist/lib/`. */
10
+ const PLUGIN_ROOT = join(dirname(fileURLToPath(import.meta.url)), "..", "..");
11
+ export function resolveAllowlistScript() {
12
+ return join(PLUGIN_ROOT, ALLOWLIST_SCRIPT_RELATIVE);
13
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * The committed request artifacts under `schema/`, as the plugin uses them: a tool's
3
+ * `parameters`. Never a hand-mirror — the bytes are the contract, and a second copy of a
4
+ * shape is the first to drift from it.
5
+ */
6
+ import { readFileSync } from "node:fs";
7
+ import { dirname, join } from "node:path";
8
+ import { fileURLToPath } from "node:url";
9
+ /** The repo root's `schema/`, resolved from both `src/lib/` and `dist/lib/`. It
10
+ * ships via `package.json#files`. */
11
+ const SCHEMA_DIR = join(dirname(fileURLToPath(import.meta.url)), "..", "..", "schema");
12
+ /**
13
+ * The tool's request artifact as the host's `parameters`, with the three FILE annotations
14
+ * stripped: `$schema`, `$id` and `title` describe the file rather than the value, and a
15
+ * `$id` on a tool input invites a host to resolve a URL nobody serves. A missing or
16
+ * shapeless artifact throws at the call site — a broken build, not a runtime state to
17
+ * model.
18
+ */
19
+ export function requestSchema(tool) {
20
+ const stem = tool.slice("shopping_".length).replaceAll("_", "-");
21
+ const path = join(SCHEMA_DIR, `shopping-${stem}-request.schema.json`);
22
+ const parsed = JSON.parse(readFileSync(path, "utf8"));
23
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
24
+ throw new Error(`${path}: request artifact is not a JSON Schema object`);
25
+ }
26
+ const schema = { ...parsed };
27
+ for (const annotation of ["$schema", "$id", "title"])
28
+ delete schema[annotation];
29
+ return schema;
30
+ }
@@ -30,9 +30,8 @@ import { join } from "node:path";
30
30
  import { randomBytes } from "node:crypto";
31
31
  /** Owner read/write only. The bearer pair must never be group/world-readable. */
32
32
  const FILE_MODE = 0o600;
33
- /** Owner read/write/execute only on the data dir itself. Exported so the one
34
- * other writer of a `$SIL_DATA_DIR` sub-tree (`profile-store.ts`, the SDS
35
- * artefact store) shares this single source of truth for the data-home mode
33
+ /** Owner read/write/execute only on the data dir itself. Exported so
34
+ * `sil_doctor`'s mode check shares one source of truth for the data-home mode
36
35
  * rather than duplicating the literal. */
37
36
  export const DIR_MODE = 0o700;
38
37
  const TOKENS_FILE = "tokens.json";